<template>
  <div>
    <el-tabs v-model="activeKey" @tab-click="handleClick">
      <el-tab-pane label="支付订单" name="1"> </el-tab-pane>
      <el-tab-pane label="退款订单" name="2"></el-tab-pane>
      <el-tab-pane label="批量退款" name="3"></el-tab-pane>
    </el-tabs>
      <el-card style="position: relative; min-width: 1200px; overflow: inherit" v-if="activeKey == '1'">
      <div v-if="eventTab == '1'" class="tableSelectWrap">
        <el-form ref="dealWaterForm" :model="commandForm" label-width="100px">
          <el-row>
            <el-col :span="7" style="display: flex">
              <el-form-item prop="dateType" label-width="0">
                <el-select
                  class="leftSelect"
                  v-model="commandForm.dateType"
                  style="width: 100px; border-radius: none"
                  placeholder="选择时间"
                >
                  <el-option label="创建时间" value="1"></el-option>
                  <el-option label="支付时间" value="2"></el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="date" label-width="0" style="flex: 1">
                <el-date-picker
                  v-model="commandForm.date"
                  style="width: 100%; border-radius: 0px; margin-top: 1px"
                  type="datetimerange"
                  start-placeholder="开始时间"
                  :default-time="['00:00:00', '23:59:59']"
                  end-placeholder="结束时间"
                  :clearable="false"
                  value-format="yyyy-MM-dd HH:mm:ss"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>

            <el-col
              :span="7"
              :offset="1"
              :style="{
                display: this.commandForm.payformChannel ? 'flex' : '',
              }"
            >
              <el-form-item label="支付渠道" prop="payformChannel">
                <el-select
                  v-model="commandForm.payformChannel"
                  class="leftSelect"
                  style="width: 100%"
                  placeholder="请选择支付渠道"
                  clearable
                  @change="handleChannel"
                >
                  <el-option
                    v-for="(item, index) of payChannel"
                    :key="index"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label=""
                prop="payType"
                label-width="0"
                v-if="commandForm.payformChannel"
              >
                <el-select
                  class="rightSelect"
                  v-model="commandForm.payType"
                  style="width: 100%"
                  placeholder="请选择"
                  clearable
                >
                  <el-option
                    v-for="(item, index) of payChannelTypeList"
                    :key="index"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <el-form-item label="支付状态" prop="status">
                <el-select
                  v-model="commandForm.status"
                  style="width: 100%"
                  placeholder="请选择支付状态"
                  clearable
                >
                  <el-option
                    v-for="item of payStateList"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="7">
              <el-form-item label="退款状态" prop="refundState">
                <el-select
                  v-model="commandForm.refundState"
                  style="width: 100%"
                  placeholder="请选择退款状态"
                  clearable
                >
                  <el-option
                    v-for="item of refundCaseList"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="7"  :offset="1" style="min-width: 170px">
              <el-button class="width120" @click="this.resetFields"
                >重置</el-button
              >
              <el-button
                type="primary"
                class="width120"
                @click="
                  () => {
                    this.dataForm = JSON.parse(
                      JSON.stringify(this.commandForm)
                    );
                    this.handleQuery();
                  }
                "
                >查询</el-button
              >
            </el-col>
          </el-row>
          <el-row>
            <el-button
              @click="exchangeEventTab"
              icon="el-icon-search"
              class="searchBtn"
              >精确搜索</el-button
            >
          </el-row>
        </el-form>
      </div>
      <div v-if="eventTab == '2'" class="tabWrap">
        <el-input
          class="search"
          v-model="commandForm.payformNo"
          clearable
          placeholder="请输入商户订单号/商品名称/渠道流水号/云尘付流水号"
          @keyup.enter.native="
            () => {
              this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
              this.globalQuery();
            }
          "
        >
        </el-input>
        <div class="searBtn">
          <el-button
            type="primary"
            @click="
              () => {
                this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
                this.globalQuery();
              }
            "
            >搜索</el-button
          >
        </div>
        <div class="backWrap" @click="exchangeEventTab">
          <span>筛选搜索</span>
          <img src="@/assets/imgs/setting/down1.png" />
        </div>
      </div>
    </el-card>
    <el-card style="position: relative; min-width: 1200px; overflow: inherit" v-if="activeKey == '2'">
      <div class="tableSelectWrap">
        <el-form ref="dealWaterForm" :model="commandForm" label-width="100px">
          <el-row>
            <el-col :span="7">
              <el-form-item prop="date" label="选择时间">
                <el-date-picker
                  v-model="commandForm.date"
                  style="width: 100%; border-radius: 0px; margin-top: 1px"
                  type="datetimerange"
                  start-placeholder="开始时间"
                  :default-time="['00:00:00', '23:59:59']"
                  end-placeholder="结束时间"
                  :clearable="false"
                  value-format="yyyy-MM-dd HH:mm:ss"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>

            <el-col
              :span="7"
              :offset="1"
              :style="{
                display: this.commandForm.payformChannel ? 'flex' : '',
              }"
            >
              <el-form-item label="支付渠道" prop="payformChannel">
                <el-select
                  v-model="commandForm.payformChannel"
                  class="leftSelect"
                  style="width: 100%"
                  placeholder="请选择支付渠道"
                  clearable
                  @change="handleChannel"
                >
                  <el-option
                    v-for="(item, index) of payChannel"
                    :key="index"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label=""
                prop="payType"
                label-width="0"
                v-if="commandForm.payformChannel"
              >
                <el-select
                  class="rightSelect"
                  v-model="commandForm.payType"
                  style="width: 100%"
                  placeholder="请选择"
                  clearable
                >
                  <el-option
                    v-for="(item, index) of payChannelTypeList"
                    :key="index"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <el-form-item label="退款状态" prop="refundStatus">
                <el-select
                  v-model="commandForm.refundStatus"
                  style="width: 100%"
                  placeholder="请选择退款状态"
                  clearable
                >
                  <el-option
                    v-for="item of refundStateList"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="7" style="min-width: 170px">
              <el-button class="width120" @click="this.resetFields"
                >重置</el-button
              >
              <el-button
                type="primary"
                class="width120"
                @click="
                  () => {
                    this.dataForm = JSON.parse(
                      JSON.stringify(this.commandForm)
                    );
                    this.handleQuery();
                  }
                "
                >查询</el-button
              >
            </el-col>
          </el-row>
        </el-form>
      </div>
    </el-card>
    <el-card style="position: relative; min-width: 1200px; overflow: inherit" v-if="activeKey == '3'">
      <div v-if="eventTab == '1'" class="tableSelectWrap">
        <el-form ref="dealWaterForm" :model="commandForm" label-width="100px">
          <el-row>
            <el-col :span="7">
              <el-form-item prop="date" label="选择时间">
                <el-date-picker
                  v-model="commandForm.date"
                  style="width: 100%; border-radius: 0px; margin-top: 1px"
                  type="datetimerange"
                  start-placeholder="开始时间"
                  :default-time="['00:00:00', '23:59:59']"
                  end-placeholder="结束时间"
                  :clearable="false"
                  value-format="yyyy-MM-dd HH:mm:ss"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="7" :offset="1">
              <el-form-item label="退款情况" prop="refundStatus">
                <el-select
                  v-model="commandForm.refundStatus"
                  style="width: 100%"
                  placeholder="请选择退款情况"
                  clearable
                >
                  <el-option
                    v-for="item of refundCaseList"
                    :key="item.id"
                    :label="item.label"
                    :value="item.value"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="7"  :offset="1" style="min-width: 170px">
              <el-button class="width120" @click="this.resetFields"
                >重置</el-button
              >
              <el-button
                type="primary"
                class="width120"
                @click="
                  () => {
                    this.dataForm = JSON.parse(
                      JSON.stringify(this.commandForm)
                    );
                    this.handleQuery();
                  }
                "
                >查询</el-button
              >
            </el-col>
          </el-row>
          <el-row>
            <el-button
              @click="exchangeEventTab"
              icon="el-icon-search"
              class="searchBtn"
              >精确搜索</el-button
            >
          </el-row>
        </el-form>
      </div>
      <div v-if="eventTab == '2'" class="tabWrap">
        <el-input
          class="search"
          v-model="commandForm.batchNo"
          clearable
          placeholder="请输入批量退款批次号"
          @keyup.enter.native="
            () => {
              this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
              this.globalQuery();
            }
          "
        >
        </el-input>
        <div class="searBtn">
          <el-button
            type="primary"
            @click="
              () => {
                this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
                this.globalQuery();
              }
            "
            >搜索</el-button
          >
        </div>
        <div class="backWrap" @click="exchangeEventTab">
          <span>筛选搜索</span>
          <img src="@/assets/imgs/setting/down1.png" />
        </div>
      </div>
    </el-card>
    <el-card  v-if="activeKey == '1'"
      class="textBox"
      style="min-width: 1200px; margin-bottom: -5px; margin-top: 15px"
    >
      <span class="numBox">
        <span>订单总额</span>
        <span class="symbol">￥</span>
        <span class="num">{{ info.fmtOrderTotalAmount || 0.0 }}</span>
      </span>
      <span class="numBox">
        <span>已支付</span>
        <span class="symbol">￥</span>
        <span class="num">{{ info.fmtPayTotalAmount || 0.0 }}</span>
      </span>
      <span class="numBox">
        <span>已退款</span>
        <span class="symbol">￥</span>
        <span class="num">{{ info.fmtRefundTotalAmount || 0.0 }}</span>
      </span>
    </el-card>

    <el-card style="margin-top: 20px; min-width: 1200px">
      <div class="switch">
        <div>
          <el-switch v-model="isFixedTableH" inactive-text="固定表头">
          </el-switch>
        </div>
                <el-button
          class="width120"
          v-if="activeKey == '3'"
          type="primary"
          @click="createRefundAll"
          >创建批量退款</el-button
        >
        <el-button
          class="width120"
          v-if="!btnShow&&activeKey == '1' "
          type="primary"
          @click="btnShow = true"
          >批量处理</el-button
        >
        <div v-if="btnShow&&activeKey == '1'">
          <el-button
            class="width120"
            @click="
              btnShow = false;
              multipleSelection = [];
              $refs.multipleTable.clearSelection();
            "
            >取消</el-button
          >
          <el-button class="width120" type="primary" @click="refundAll"
            >批量退款</el-button
          >
        </div>
      </div>
      <el-table v-show="activeKey=='1'"
        :data="dataList"
        ref="multipleTable"
        :height="fixedTableHeight"
        @selection-change="handleSelectionChange"
      >
        <template slot="empty">
          <el-empty
            :image="require('@/assets/imgs/middleWork/k1.png')"
            :image-size="80"
            description="暂无相关数据"
          ></el-empty>
        </template>
        <el-table-column
          show-overflow-tooltip
          v-if="btnShow"
          type="selection"
          width="55"
          :selectable="
            (row) =>
              row.refundButton
          "
        ></el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="gmtCreated"
          align="center"
          label="创建时间"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{ scope.row.gmtCreated ? scope.row.gmtCreated : "-" }}
            </div>
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="payTime"  align="center" label="支付时间">
          <template slot-scope="scope">
          <div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
            {{scope.row.payTime?scope.row.payTime:'-'}}
          </div>
        </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="payformNo"
          align="center"
          label="商户订单号"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{
                scope.row.merchantChargeNo ? scope.row.merchantChargeNo : "-"
              }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="subject"
          align="center"
          label="商品名称"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{ scope.row.subject ? scope.row.subject : "-" }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="fmtActualAmount"
          align="center"
          label="支付金额/元"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{
                scope.row.fmtActualAmount ? scope.row.fmtActualAmount : "0.00"
              }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="channelPayFormTypeName"
          align="center"
          label="支付渠道"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              <span>{{
                scope.row.channelName ? scope.row.channelName : "-"
              }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="statusName"
          align="center"
          label="支付状态"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{
                scope.row.statusName ? scope.row.statusName : "-"
              }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="fmtRefundAmount"
          align="center"
          label="退款金额/元"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{
                scope.row.fmtRefundAmount ? scope.row.fmtRefundAmount : "0.00"
              }}
            </div>
          </template>
        </el-table-column>

        <el-table-column
          show-overflow-tooltip
          prop="address"
          align="center"
          label="操作"
        >
          <template slot-scope="scope">
            <el-button type="text" @click="handleDetails(scope.row)"
              >详情</el-button
            >
            <el-button
            v-if="
              scope.row.refundButton
            "
              type="text"
              @click="refundMoney(scope.row)"
              >退款</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-table
        v-show="activeKey == '2'"
        :data="dataList"
        :height="fixedTableHeight"
      >
        <template slot="empty">
          <el-empty
            :image="require('@/assets/imgs/middleWork/k1.png')"
            :image-size="80"
            description="暂无相关数据"
          ></el-empty>
        </template>
        <el-table-column
          show-overflow-tooltip
          prop="gmtCreated"
          align="center"
          label="创建时间"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{ scope.row.gmtCreated ? scope.row.gmtCreated : "-" }}
            </div>
          </template>
        </el-table-column>
        <el-table-column show-overflow-tooltip prop="refundTime" align="center" label="完成时间">
            <template slot-scope="scope">
            <div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
              {{scope.row.refundTime?scope.row.refundTime:'-'}}
            </div>
          </template>
          </el-table-column>
        <el-table-column show-overflow-tooltip prop="innerRefundNo" align="center" label="云尘付流水号">
            <template slot-scope="scope">
            <div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">
              {{scope.row.innerRefundNo?scope.row.innerRefundNo:'-'}}
            </div>
          </template>
          </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="thirdRefundNo"
          align="center"
          label="渠道流水号"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{ scope.row.thirdRefundNo ? scope.row.thirdRefundNo : "-" }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="refundAmountStr"
          align="center"
          label="退款金额/元"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{
                scope.row.refundAmountStr ? scope.row.refundAmountStr : "0.00"
              }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="reason"
          align="center"
          label="退款理由"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{
                scope.row.reason
                  ? scope.row.reason
                  : "-"
              }}
            </div>
          </template>
        </el-table-column>

        <el-table-column
          show-overflow-tooltip
          prop="payChannelName"
          align="center"
          label="支付渠道"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              <span>{{
                scope.row.payChannelName
                  ? scope.row.payChannelName
                  : "-"
              }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="refundStatusName"
          align="center"
          label="退款状态"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
            <span>{{
                scope.row.refundStatusName
                  ? scope.row.refundStatusName
                  : "-"
              }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="address"
          align="center"
          label="操作"
        >
          <template slot-scope="scope">
            <el-button type="text" @click="handleDetails(scope.row)"
              >详情</el-button
            >
          </template>
        </el-table-column>
      </el-table>
      <el-table
        v-show="activeKey == '3'"
        :data="dataList"
        :height="fixedTableHeight"
      >
        <template slot="empty">
          <el-empty
            :image="require('@/assets/imgs/middleWork/k1.png')"
            :image-size="80"
            description="暂无相关数据"
          ></el-empty>
        </template>
        <el-table-column
          show-overflow-tooltip
          prop="gmtCreated"
          align="center"
          label="创建时间"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{ scope.row.gmtCreated ? scope.row.gmtCreated : "-" }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="batchNo"
          align="center"
          label="退款批次号"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{ scope.row.batchNo ? scope.row.batchNo : "-" }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="totalAmountStr"
          align="center"
          label="退款总金额/元"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              {{
                scope.row.totalAmountStr
                  ? scope.row.totalAmountStr
                  : "0.00"
              }}
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="refundSize"
          align="center"
          label="退款总笔数/笔"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
              <span>{{
                scope.row.refundSize ? scope.row.refundSize : "-"
              }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="result"
          align="center"
          label="结果"
        >
          <template slot-scope="scope">
            <div
              style="
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              "
            >
            <span>{{
                scope.row.result ? scope.row.result : "-"
              }}</span>
            </div>
          </template>
        </el-table-column>
        <el-table-column
          show-overflow-tooltip
          prop="address"
          align="center"
          label="操作"
        >
          <template slot-scope="scope">
            <el-button type="text" @click="handleDetails(scope.row)"
              >详情</el-button
            >
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <el-pagination
      layout="prev, pager, next, sizes, jumper"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="pageSize"
      :current-page="pageNum"
      :total="total"
      @current-change="pageCurrentChangeHandle"
      @size-change="pageSizeChangeHandle"
    >
    </el-pagination>
    <el-dialog
      title=""
      class="tkDialog"
      :visible="refundDialog"
      width="449px"
      :close-on-click-modal="false"
      :show-close="false"
    >
      <div class="dialogTitle">退款申请</div>
      <el-form
        :model="form"
        ref="refundForm"
        :rules="rules"
        label-position="top"
      >
      <el-form-item label="云尘付流水号" prop="innerChargeNo"  v-if="!isRefundAll">
          <el-input
            v-model="form.innerChargeNo"
            maxlength="30"
            disabled
            placeholder="输入云尘付流水号"
          ></el-input>
        </el-form-item>
        <el-form-item
          :label="
            '退款金额' 
          "
          prop="refundAmount"
          v-if="!isRefundAll"
        >
          <el-input
            type="number"
            v-model="form.refundAmount"
            :placeholder="'退款金额不可超过'+ (
            this.refundRow.fmtActualAmount - this.refundRow.fmtRefundAmount
          ).toFixed(2)+'元'"
            :step="0.01"
            oninput="if(isNaN(value)) { value = parseFloat(value) } if(value.indexOf('.')>0){value=value.slice(0,value.indexOf('.')+3)}"
          >
            <template slot="append">元</template>
          </el-input>
        </el-form-item>
        <el-form-item label="退款理由" prop="refundRemark">
          <el-input
            v-model="form.refundRemark"
            maxlength="30"
            placeholder="输入退款理由"
            autocomplete="off"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          @click="
            refundDialog = false;
            $refs['refundForm'].resetFields();
          "
          class="width120"
          >取消</el-button
        >
        <el-button type="primary" class="width120" @click="confirmRefund"
          >确定</el-button
        >
      </div>
    </el-dialog>
    <el-dialog
      title=""
      class="tkDialog"
      :visible="createRefundAllShow"
      :width="RefundAllOne?'449px':'849px'"
      :close-on-click-modal="false"
      :show-close="false"
    >
      <div class="dialogTitle">创建批量退款</div>
      <div v-if="RefundAllOne">
        <el-tabs v-model="createRefundAllIndex" class="tabs"  style="margin-top: -30px;">
      <el-tab-pane  label="手动填写" name="1" > </el-tab-pane>
      <el-tab-pane  label="导入文件" name="2"></el-tab-pane>
    </el-tabs>
      <br />
      <div v-if="createRefundAllIndex=='1'">
        <el-form ref="createRefundAllForm" :model="createRefundAllForm">
  <el-form-item label="">
    <el-radio-group v-model="createRefundAllForm.type">
      <el-radio label="merchant">商户订单号</el-radio>
      <el-radio label="inner">云尘流水号</el-radio>
    </el-radio-group>
  </el-form-item>
  <el-form-item label="">
    <el-input type="textarea"   :rows="8"
  placeholder="请输入订单号，每行一个单号，回车换行
最多支持100条数据" v-model="createRefundAllForm.ids"></el-input>
  </el-form-item>

</el-form>
      </div>
      <div v-if="createRefundAllIndex=='2'">
<br>
<br>
        <div style="width:100%;text-align: center;line-height: 20px;color:#869DAA;">
          <el-upload
          ref="upload"
  action="/merchantApi/api/refund/batch/create/upload"
  :headers="{
    api_mode:'live',
           auth_token: getToken(),
           auth_tmp: curTmp,
                  auth_tck: curTck,
           }"
  :on-remove="handleRemove"
  :on-success="handleSuccess"
  :limit="1"
  style="margin-bottom:30px;">
  <el-button size="medium" type="primary">上传文件</el-button>
</el-upload>
<div style="font-size: 12px">批量退款请务必使用提供的模板文件，填写规范及模板下载如下：</div>
<div style="font-size: 12px">
  商户订单号模板: <a href='/merchantApi/api/refund/batch/create/download?type=merchant' style="color:#03BFC6;cursor: pointer;">云尘付批量退款_商户订单号.Excel</a>
</div>
<div style="font-size: 12px">
  云尘付流水号模板: <a href='/merchantApi/api/refund/batch/create/download?type=inner' style="color:#03BFC6;cursor: pointer;">云尘付批量退款_云尘付流水号.Excel</a>
</div>
</div>
      </div>
      </div>
      <div v-else>
        <el-tabs v-model="createRefundAllTwoIndex" class="tabs"  style="margin-top: -30px;">
      <el-tab-pane  label="有效订单" name="yes" ></el-tab-pane>
      <el-tab-pane  label="无效订单" name="no"></el-tab-pane>
    </el-tabs>
      <br />
      <div v-if="createRefundAllTwoIndex=='yes'">
        <el-table
      :data="orderList.validRefunds"
      style="width: 100%">
      <el-table-column
        prop="channelTag"
        label="支付渠道"
      >
      </el-table-column>
      <el-table-column
        prop="chargeNo"
        label="订单号"
      >
      </el-table-column>
      <el-table-column
        prop="chargeAmountStr"
        label="订单金额/元">
      </el-table-column>
      <el-table-column
        prop="hasRefundAmountStr"
        label="已退金额/元">
      </el-table-column>
      <el-table-column
        prop="refundAmountStr"
        label="退款金额/元">
      </el-table-column>
    </el-table>
    <div>退款理由</div>
    <br>
    <el-input placeholder="请输入退款理由" v-model="createRefundAllForm.reason"></el-input>
      </div>
      <div v-if="createRefundAllTwoIndex=='no'">
        <el-table
      :data="orderList.invalidRefunds"
      style="width: 100%">
      <el-table-column
        prop="channelTag"
        label="支付渠道"
       >
      </el-table-column>
      <el-table-column
        prop="chargeNo"
        label="订单号"
    >
      </el-table-column>
      <el-table-column
        prop="errorReason"
        label="异常原因">
      </el-table-column>
    </el-table>
      </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button
          @click="
            createRefundAllShow = false;"
          class="width120"
          >取消</el-button
        >
        <el-button v-if="RefundAllOne" type="primary" class="width120" @click="nextRefundAll">下一步</el-button>
        <el-button v-else type="primary" class="width120" @click="consentRefundAll">确定</el-button>
      </div>
    </el-dialog>
    <!-- 详情抽屉 -->
    <detail-drawer
      :drawer.sync="drawer"
      :info="detailsInfo"
      :activeKey="activeKey"
    ></detail-drawer>
  </div>
</template>

<script>
import detailDrawer from "./detailDrawer.vue";
import mixin from "@/mixins/mixin";
import { isAmount } from "@/utils/validate";
import { setTabIndex, getTabIndex,getToken } from "@/utils/public";
import crypto from "@/crypto";
import { randomWord } from "@/utils/getRandom";
export default {
  mixins: [mixin],
  name: "dealWater",
  components: {
    detailDrawer,
  },
  data() {
    const verifyAmount = (rule, value, callback) => {
      if (value.length <= 0) {
        callback(new Error("请输入退款金额"));
      } else if (
        Number(value) >
        parseFloat(
          (
            this.refundRow.fmtActualAmount - this.refundRow.fmtRefundAmount
          ).toFixed(2)
        )
      ) {
        callback(
          new Error(
            "退款金额不可超过" +
              parseFloat(
                (
                  this.refundRow.fmtActualAmount -
                  this.refundRow.fmtRefundAmount
                ).toFixed(2)
              ) +
              "元"
          )
        );
      } else {
        if (value > 0) {
          if (!isAmount(value)) {
            callback(new Error("退款金额必须为整数或者保留两位小数"));
          }
          callback();
        } else {
          callback(new Error("退款金额必须大于0"));
        }
      }
    };
    return {
      activeKey: getTabIndex(),
      eventTab: "1",
      refundRow: {},
      multipleSelection: [],
      refundIds: [],
      isRefundAll: false, // 是否是批量退款
      btnShow: false,
      buttonRole: false,
      refundDialog: false,
      detailsInfo: {},
      drawer: false,
      mixinViewModuleOptions: {
        getDataListURL: "/api/charge/listByPage",
        createdIsNeed: false,
      },
      dataList: [],
      dataForm: {},
      commandForm: {
        payformNo: this.$route.query.searchId ? this.$route.query.searchId : "",
        refundNo: "",
        dateType: "1",
        date: [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ],
        refundStatus: "",
        refundState: "",
        status:"",
        payformChannel: "",
        payType: "",
      },
      form: {
        refundRemark: "",
        refundAmount: "",
        innerChargeNo:"",
      },
      rules: {
        refundRemark: [
          { required: false, message: "请输入退款理由", trigger: "change" },
          {
            pattern: /^(?!\s+).*(?<!\s)$/,
            message: "格式有误",
            trigger: "change",
          },
        ],
        refundAmount: [
          { required: true, message: "请输入退款金额", trigger: "change" },
          { validator: verifyAmount, trigger: "change" },
        ],
      },
      payStateList: [
        // 支付状态
        { id: 1, label: "所有", value: "" },
        { id: 2, label: "待支付", value: "created" },
        { id: 3, label: "支付中", value: "pending" },
        { id: 4, label: "支付成功", value: "success" },
        { id: 5, label: "支付失败", value: "fail" },
        { id: 6, label: "关闭订单", value: "close" },
      ],
      refundCaseList: [
        // 退款情况
        { id: 1, label: "所有", value: "" },
        { id: 2, label: "无退款", value: "no_refund" },
        { id: 3, label: "部分退款", value: "part_refund" },
        { id: 4, label: "全额退款", value: "all_refund" },
      ],
      payChannel: [],
      // payChannel: this.$store.state.channelList,
      payChannelType: this.$store.state.channelListType,
      payChannelTypeList: [],
      info: {},
      payformId: null,
      searchVal: "", // 搜索框的值
      refundStateList: [
        { id: 1, label: "所有", value: "" },
        { id: 2, label: "待退款", value: "waiting" },
        { id: 3, label: "处理中", value: "pending" },
        { id: 4, label: "退款失败", value: "fail" },
        { id: 5, label: "退款成功", value: "success" },
      ],
      RefundAllOne:true,
      createRefundAllShow:false,
      createRefundAllIndex:"1",
      createRefundAllTwoIndex:"",
      createRefundAllForm:{
        ids:'',
        type:'merchant',
        reason:''
      },
      orderList:{},
      fileList:{},
      curTmp: null,
      curTck: null,
      len: [8, 9, 10, 11, 12][
        Math.floor(Math.random() * [8, 9, 10, 11, 12].length)
      ],
    };
  },
  created() {
    this.curTmp = new Date().getTime();
    this.curTck = crypto.set(
      getToken() + "_" + this.curTmp + "_" + randomWord(this.len),
      "a1g0qoalvv19aed3"
    );
    this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
    if (this.$store.state.buttonList) {
      this.$store.state.buttonList.forEach((e) => {
        if (e.type == "refund") {
          this.buttonRole = true;
        }
      });
    }
    if (!this.commandForm.payformChannel) {
      this.payChannelTypeList = [{ label: "所有", value: "" }];
    }
    this.getChannelList();
  },
  mounted() {
    //搜索
    if (Object.keys(this.$route.query).length) {
      this.commandForm.payformNo = this.$route.query.searchId;
      this.commandForm = {
        payformNo: this.commandForm.payformNo,
      };
      this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
      this.globalQuery();
    } else {
      this.handleQuery();
    }
  },
  watch: {
    "$route.query"() {
      if (this.$route.name == this.$options.name) {
        if (this.$route.query.searchId) {
          this.commandForm = {
            payformNo: this.$route.query.searchId,
          };
          this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
          this.globalQuery();
          setTimeout(() => {
            this.$router.push(this.$route.path);
          }, 0);
        }
      }
    },
    "$store.state.testLine": {
      handler() {
        if (this.$route.name == this.$options.name) {
          if (Object.keys(this.$route.query).length) {
            this.commandForm.payformNo = this.$route.query.searchId;
            this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
            this.globalQuery();
          } else {
            if (this.eventTab == "1") {
              this.handleQuery();
            } else if (this.eventTab == "2") {
              this.globalQuery();
            }
          }
        }
      },
    },
    deep: true,
  },
  methods: {
    getTabIndex,
    getToken,
    handleRemove(){
      this.fileList = {};
    },
    handleSuccess(res){
      this.fileList = {};
      if(res.code=='0000'){
        this.fileList = res.data;
      }else{
        this.$refs["upload"].clearFiles();
        this.$message.error(res.msg)
      }
    },
    getChannelList() {
      this.$http.get("/api/dict/channelList").then((res) => {
        if (res.code === "0000") {
          var a = [{ label: "所有", value: "" }];
          var b = a.concat(res.data);
          this.payChannel = b;
        }
      });
    },
    exchangeEventTab() {
      if(this.activeKey=='1'){
        if (this.eventTab == "1") {
        this.eventTab = "2";
        this.commandForm = {
          payformNo: this.commandForm.payformNo,
        };
        this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
        this.globalQuery();
      } else {
        this.eventTab = "1";
        this.commandForm = {
          payformNo: this.$route.query.searchId
            ? this.$route.query.searchId
            : "",
          refundNo: "",
          dateType: "1",
          date: [
            this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
            this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
          ],
          refundStatus: "",
          refundState: "",
          status:"",
          payformChannel: "",
          payType: "",
        };
        this.dataForm = JSON.parse(JSON.stringify(this.commandForm));
        this.handleQuery();
      }
      }else if(this.activeKey=='3'){
        if (this.eventTab == "1") {
        this.eventTab = "2";
        this.commandForm = {
          batchNo: this.searchVal,
        };
    this.dataForm=JSON.parse(JSON.stringify(this.commandForm))
        this.globalQuery();
      } else {
        this.eventTab = "1";
        this.commandForm = {
        date: [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ],
        refundStatus: "",
      };
    this.dataForm=JSON.parse(JSON.stringify(this.commandForm))
        this.handleQuery();
      }
      }

    },
    //重置操作
    resetFields() {
      if(this.activeKey=='1'){
this.commandForm={
        dateType: "1",
        date: [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ],
        refundState: "",
        status:"",
        payformChannel: "",
        payType: "",
}
      }else if(this.activeKey=='2'){
        this.commandForm={
        date: [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ],
        refundStatus: "",
        payformChannel: "",
        payType: "",
}
}else if(this.activeKey=='3'){
        this.commandForm={
        date: [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ],
        refundStatus: "",
}
      }
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    createRefundAll(){
this.createRefundAllShow=true
this.RefundAllOne=true
this.createRefundAllForm={
        ids:'',
        type:'merchant',
        reason:''
      }
      this.orderList={}
      this.fileList={}
      this.createRefundAllIndex='1'
    },
    nextRefundAll(){
        if(this.createRefundAllIndex=='1'){
          if(this.createRefundAllForm.ids){
            this.$http
              .post("/api/refund/batch/create/input", {
                ids: this.createRefundAllForm.ids,
                type: this.createRefundAllForm.type
              })
              .then((res) => {
                if (res.code === "0000") {
                  this.RefundAllOne=false
this.createRefundAllTwoIndex="yes"
    this.orderList=res.data
                }
              });
          }else{
            this.$message.warning('请填写内容')
          }

      }else if(this.createRefundAllIndex=='2'){
        if(this.fileList.validRefunds){
                  this.RefundAllOne=false
this.createRefundAllTwoIndex="yes"
    this.orderList=this.fileList
          }else{
            this.$message.warning('请上传文件')
          }
      }
    },
    consentRefundAll(){
      if(this.orderList.validRefunds&&this.orderList.validRefunds.length){
        this.$http
              .post("/api/refund/batch/create/submit", {
                validRefunds: this.orderList.validRefunds,
                reason:this.createRefundAllForm.reason
              })
              .then((res) => {
                if (res.code === "0000") {
  this.createRefundAllShow=false
  this.$message.success("创建批量退款成功！");
  this.getDataList()
                }
              });
      }else{
        this.$message.warning("暂无可退款的有效订单！");
      }
   
    },
    refundAll() {
      if (this.multipleSelection.length === 0) {
        return this.$message.warning("请先选择退款订单");
      } else {
        let that = this;
        that
          .$confirm(
            "确认退款后，无需审核的将直接发起退款，需要审核的需审核人同意后方可发起退款，审核人拒绝则该笔订单状态不变，退款成功后退款金额将于7个工作日内原路原回。",
            "确认执行",
            {
              customClass: "confirm",
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              showClose: false,
              closeOnClickModal: false,
              closeOnPressEscape: false,
              type: "warning",
              center: true,
            }
          )
          .then(() => {
            that.refundIds = that.multipleSelection.map((item) => item.id);
            that.refundDialog = true;
            that.isRefundAll = true;
          });
      }
    },
    handleDetails(row) {
      switch (this.activeKey) {
        case "1":
          this.$http.get(`/api/charge/detail?id=${row.id}`).then((res) => {
            if (res.code === "0000") {
              this.detailsInfo = res.data;
              this.drawer = true;
            }
          });
          break;
          case "2":
          this.$http
            .get(`/api/refund/trade/detail?id=${row.id}`)
            .then((res) => {
              if (res.code === "0000") {
                this.detailsInfo = res.data;
                this.drawer = true;
              }
            });
          break;
        case "3":
          this.$http
            .get(
              `/api/refund/batch/detail?id=${row.id}`
            )
            .then((res) => {
              if (res.code === "0000") {
                this.detailsInfo = res.data;
                this.drawer = true;
              }
            });
          break;
        default:
          break;
      }
    },
    // 退款
    refundMoney(row) {
      let that = this;
      that
        .$confirm(
          "确认退款后，无需审核的将直接发起退款，需要审核的需审核人同意后方可发起退款，审核人拒绝则该笔订单状态不变，退款成功后退款金额将于7个工作日内原路原回。",
          "确认执行",
          {
            customClass: "confirm",
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            showClose: false,
            closeOnClickModal: false,
            closeOnPressEscape: false,
            type: "warning",
            center: true,
          }
        )
        .then(() => {
          that.payformId = row.id;
          that.refundRow = row;
          that.refundDialog = true;
            that.form.refundAmount = that.refundRow.fmtActualAmount;
            that.form.innerChargeNo=that.refundRow.innerChargeNo
          that.isRefundAll = false;
        });
    },
    confirmRefund() {
      this.$refs.refundForm.validate((valid) => {
        if (valid) {
          if (this.isRefundAll) {
            this.$http
              .post("/api/refund/charge/batch/create", {
                chargeIds: this.refundIds,
                reason: this.form.refundRemark,
              })
              .then((res) => {
                if (res.code === "0000") {
                  this.$message.success("已提交！");
                  this.$refs["refundForm"].resetFields();
                  this.refundDialog = false;
                  this.form.refundRemark = "";
                  if (this.eventTab == "1") {
                    this.handleQuery();
                  } else if (this.eventTab == "2") {
                    this.globalQuery();
                  }
                }
              });
          } else {
            // 单笔退款
            this.$http
              .post("/api/refund/charge/create", {
                chargeId: this.payformId,
                reason: this.form.refundRemark,
                refundAmountStr: this.form.refundAmount,
              })
              .then((res) => {
                if (res.code === "0000") {
                  this.$message.success("已提交！");
                  this.$refs["refundForm"].resetFields();
                  this.refundDialog = false;
                  this.form.refundRemark = "";
                  if (this.eventTab == "1") {
                    this.handleQuery();
                  } else if (this.eventTab == "2") {
                    this.globalQuery();
                  }
                }
              });
          }
        }
      });
    },
    handleClick() {
      this.dataList=[]
      if(this.btnShow){
this.btnShow=false
      }
      setTabIndex(this.activeKey);
      this.pageSize = 10;
      this.payChannelTypeList = [];
      if(this.activeKey=='1'){
this.commandForm={
        dateType: "1",
        date: [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ],
        refundState: "",
        status:"",
        payformChannel: "",
        payType: "",
}
      }else if(this.activeKey=='2'){
        this.commandForm={
        date: [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ],
        refundStatus: "",
        payformChannel: "",
        payType: "",
}
}else if(this.activeKey=='3'){
        this.commandForm={
        date: [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ],
        refundStatus: "",
}
      }
      this.dataForm=JSON.parse(JSON.stringify(this.commandForm))
      this.handleQuery();
    },
    handleQuery() {
      this.eventTab='1'
      this.searchVal = '';
      if(this.activeKey=='1'){
        this.dataForm.payformNo = "";
        this.dataForm.gmtCreatedBegin = undefined;
      this.dataForm.gmtCreatedEnd = undefined;
      this.dataForm.payTimeBegin = undefined;
      this.dataForm.payTimeEnd = undefined;
      if (this.dataForm.date && this.dataForm.date.length) {
        if (this.dataForm.dateType == "1") {
          this.dataForm.gmtCreatedBegin = this.dataForm.date[0];
          this.dataForm.gmtCreatedEnd = this.dataForm.date[1];
        } else {
          this.dataForm.payTimeBegin = this.dataForm.date[0];
          this.dataForm.payTimeEnd = this.dataForm.date[1];
        }
      } else {
        this.dataForm.date = [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ];
        if (this.dataForm.dateType == "1") {
          this.dataForm.gmtCreatedBegin = this.dataForm.date[0];
          this.dataForm.gmtCreatedEnd = this.dataForm.date[1];
        } else {
          this.dataForm.payTimeBegin = this.dataForm.date[0];
          this.dataForm.payTimeEnd = this.dataForm.date[1];
        }
      }
        this.mixinViewModuleOptions.getDataListURL =
          "/api/charge/listByPage";
        this.getStatisticsInfo();
      }else if(this.activeKey=='2'){
        this.dataForm.startTime = undefined;
      this.dataForm.endTime = undefined;
      if (this.dataForm.date && this.dataForm.date.length) {
          this.dataForm.startTime = this.dataForm.date[0];
          this.dataForm.endTime = this.dataForm.date[1];
      }else {
        this.dataForm.date = [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ];
        this.dataForm.startTime = this.dataForm.date[0];
          this.dataForm.endTime = this.dataForm.date[1];
      }
        this.mixinViewModuleOptions.getDataListURL =
          "/api/refund/trade/page";
      }else if(this.activeKey=='3'){
        this.dataForm.startTime = undefined;
      this.dataForm.endTime = undefined;
      if (this.dataForm.date && this.dataForm.date.length) {
        this.dataForm.startTime = this.dataForm.date[0];
          this.dataForm.endTime = this.dataForm.date[1];
      }else {
        this.dataForm.date = [
          this.$moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),
          this.$moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),
        ];
        this.dataForm.startTime = this.dataForm.date[0];
          this.dataForm.endTime = this.dataForm.date[1];
      }
        this.mixinViewModuleOptions.getDataListURL =
          "/api/refund/batch/page";
      }
      this.getDataList();
    },
    globalQuery() {
      this.eventTab = "2";
      if(this.activeKey=='1'){
        this.getStatisticsInfo();
      }
      this.getDataList();
    },
    getStatisticsInfo() {
        this.$http
        .post("/api/charge/statistics", {
          ...this.dataForm,
        })
        .then((res) => {
          if (res.code === "0000") {
            this.info = res.data || {};
          }
        });
    },
    handleChannel(val) {
      if (val) {
        this.payChannelTypeList = this.payChannelType[val];
      } else {
        this.payChannelTypeList = [];
      }
      this.commandForm.payType = "";
    },
  },
};
</script>

<style scoped lang="scss">
.tabWrap {
  // height: 210px;
  height: 133px;
  // background: #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  .search {
    // position: absolute;
    // top: -60px;
    // right: 0;
    width: 466px;
  }
  .backWrap {
    height: 20px;
    position: absolute;
    bottom: 8px;
    right: 10px;
    display: flex;
    align-items: center;
    cursor: pointer;
    span {
      display: inline-block;
      font-size: 14px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #03bfc6;
      margin-right: 10px;
    }
  }
}
.searchBtn {
  margin-top: 18px;
  background: #f5f5f5;
}
.title {
  color: #4f595f;
  position: relative;
  font-size: 18px;
  font-weight: 500;
  line-height: 34px;
  margin-left: 10px;
}
.textBox {
  display: flex;
  .label {
    color: #869daa;
    font-size: 14px;
    width: 120px;
    margin-left: 10px;
    text-align: right;
  }
  .val {
    font-size: 14px;
    margin-left: 20px;
    color: #869daa;
    width: 700px;
  }
}
.pedding {
  color: #f69c1f;
}
.succeed {
  color: #07a555;
}
.failed {
  color: #f42b2b;
}
.switch {
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
}
// .search {
//   position: absolute;
//   right: 0;
//   top: -164px;
// }
.ml {
  margin-left: 20px;
}
:deep(.leftSelect) {
  .el-input__inner {
    border-radius: 4px 0 0 4px;
  }
}
:deep(
    input[type="number"]::-webkit-inner-spin-button,
    input[type="number"]::-webkit-outer-spin-button
  ) {
  -webkit-appearance: none;
  margin: 0;
}
:deep(.search) {
  .el-input__inner {
    border-radius: 2px 0 0 2px;
    height: 38px;
    line-height: 38px;
  }
}
:deep(.searBtn) {
  .el-button--small {
    border-radius: 0 2px 2px 0;
    padding: 12px 24px;
  }
}
:deep(.tabs){
  width: 320px;
  .el-tabs__item{
  width: 160px;
  }
}
:deep(.el-upload-list__item){
width:369px;
  }
</style>
